package com.mallcai.bigdata.ladon.service.report.impl;

import com.mallcai.bigdata.ladon.dpl.vo.DataType;
import com.mallcai.bigdata.ladon.dpl.vo.QueryFieldType;
import lombok.Data;

/**
 * @author feixy
 * @version 1.0
 * @date 2019-07-20 11:23
 */
@Data
public class ReportQueryParamHolder {

    private String name;

    private int queryFieldType;

    private DataType dataType;

    private Object value;

    public ReportQueryParamHolder() {
    }

    public ReportQueryParamHolder(String name,Object value, DataType dataType, int queryFieldType) {
        this.name = name;
        this.dataType = dataType;
        this.value = value;
        this.queryFieldType = queryFieldType;
    }

    public static ReportQueryParamHolder createInstance(String name, Object value, DataType dataType, int queryFieldType){
         return new ReportQueryParamHolder(name, value, dataType,queryFieldType);
    }

    public String toParamNamePattern(){
        if(this.name.startsWith(":")){
            return this.name;
        }
        return String.format("#%s#", this.name);
    }
}
